﻿using System;
using TaskManager.Domain.BusinessObjects;
using TaskManager.Domain.Exceptions;

namespace TaskManager.Domain.Services
{
    /// <summary>
    /// Provides methods for <see cref="User"/> deletion
    /// </summary>
    public interface IUserDeleteService
    {
        /// <summary>
        /// Deletes user
        /// </summary>
        /// <param name="user">User</param>
        /// <param name="commit">Lambda that will be invoked if user was successfully deleted in order to commit changes</param>
        /// <remarks>Since users are stored both in the application database and ASP.Net membership's database it is 
        /// recommended to commit changes in <c>commit</c> delegate</remarks>
        /// <example>
        /// userDeleteService.Delete("user1", () => _unitOfWork.Save());
        /// </example>
        /// <exception cref="UserActionFailureException">Thrown if user can not be deleted</exception>
        void Delete(User user, Action commit);
        
        /// <summary>
        /// Deletes user
        /// </summary>
        /// <param name="userId">User identifier in the database</param>
        /// <param name="commit">Lambda that will be invoked if user was successfully deleted in order to commit changes</param>
        /// <remarks>Since users are stored both in the application database and ASP.Net membership's database it is 
        /// recommended to commit changes in <c>commit</c> delegate</remarks>
        /// <example>
        /// userDeleteService.Delete(1, () => _unitOfWork.Save());
        /// </example>
        /// <exception cref="UserActionFailureException">Thrown if user can not be deleted</exception>
        void Delete(int userId, Action commit);
    }
}